package com.hotel.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import javax.validation.constraints.*;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;

/**
 * 预订数据传输对象
 */
public class ReservationDTO {
    
    @NotBlank(message = "客户姓名不能为空")
    @Size(max = 50, message = "客户姓名长度不能超过50个字符")
    private String customerName;
    
    @NotBlank(message = "客户手机号不能为空")
    @Pattern(regexp = "^1[3-9]\\d{9}$", message = "手机号格式不正确")
    private String customerPhone;
    
    @Size(max = 18, message = "身份证号长度不能超过18个字符")
    @Pattern(regexp = "^[1-9]\\d{5}(18|19|20)\\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\\d{3}[0-9Xx]$", 
             message = "身份证号格式不正确")
    private String customerIdCard;
    
    @Email(message = "邮箱格式不正确")
    @Size(max = 100, message = "邮箱长度不能超过100个字符")
    private String customerEmail;
    
    @NotNull(message = "房间类型不能为空")
    private Long roomTypeId;
    
    private Long roomId;
    
    @NotNull(message = "入住日期不能为空")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private LocalDate checkinDate;
    
    @NotNull(message = "退房日期不能为空")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private LocalDate checkoutDate;
    
    @NotNull(message = "入住人数不能为空")
    @Min(value = 1, message = "入住人数必须大于0")
    @Max(value = 20, message = "入住人数不能超过20")
    private Integer guestCount;
    
    @NotNull(message = "房间数量不能为空")
    @Min(value = 1, message = "房间数量必须大于0")
    @Max(value = 10, message = "房间数量不能超过10")
    private Integer roomCount;
    
    @DecimalMin(value = "0.00", message = "总金额不能小于0")
    @DecimalMax(value = "999999.99", message = "总金额不能超过999999.99")
    private BigDecimal totalAmount;
    
    @DecimalMin(value = "0.00", message = "已付金额不能小于0")
    @DecimalMax(value = "999999.99", message = "已付金额不能超过999999.99")
    private BigDecimal paidAmount;
    
    @Pattern(regexp = "^(pending|confirmed|checkedin|checkedout|cancelled)$", 
             message = "预订状态只能是：pending(待确认)、confirmed(已确认)、checkedin(已入住)、checkedout(已退房)、cancelled(已取消)")
    private String status = "pending";
    
    @Pattern(regexp = "^(online|phone|walkin|agent)$", 
             message = "预订来源只能是：online(在线预订)、phone(电话预订)、walkin(现场预订)、agent(代理预订)")
    private String source;
    
    @Size(max = 500, message = "特殊要求长度不能超过500个字符")
    private String specialRequests;
    
    @Size(max = 500, message = "备注长度不能超过500个字符")
    private String remarks;
    
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime arrivalTime;
    
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime departureTime;
    
    // 构造函数
    public ReservationDTO() {}
    
    // Getter和Setter方法
    public String getCustomerName() {
        return customerName;
    }
    
    public void setCustomerName(String customerName) {
        this.customerName = customerName;
    }
    
    public String getCustomerPhone() {
        return customerPhone;
    }
    
    public void setCustomerPhone(String customerPhone) {
        this.customerPhone = customerPhone;
    }
    
    public String getCustomerIdCard() {
        return customerIdCard;
    }
    
    public void setCustomerIdCard(String customerIdCard) {
        this.customerIdCard = customerIdCard;
    }
    
    public String getCustomerEmail() {
        return customerEmail;
    }
    
    public void setCustomerEmail(String customerEmail) {
        this.customerEmail = customerEmail;
    }
    
    public Long getRoomTypeId() {
        return roomTypeId;
    }
    
    public void setRoomTypeId(Long roomTypeId) {
        this.roomTypeId = roomTypeId;
    }
    
    public Long getRoomId() {
        return roomId;
    }
    
    public void setRoomId(Long roomId) {
        this.roomId = roomId;
    }
    
    public LocalDate getCheckinDate() {
        return checkinDate;
    }
    
    public void setCheckinDate(LocalDate checkinDate) {
        this.checkinDate = checkinDate;
    }
    
    public LocalDate getCheckoutDate() {
        return checkoutDate;
    }
    
    public void setCheckoutDate(LocalDate checkoutDate) {
        this.checkoutDate = checkoutDate;
    }
    
    public Integer getGuestCount() {
        return guestCount;
    }
    
    public void setGuestCount(Integer guestCount) {
        this.guestCount = guestCount;
    }
    
    public Integer getRoomCount() {
        return roomCount;
    }
    
    public void setRoomCount(Integer roomCount) {
        this.roomCount = roomCount;
    }
    
    public BigDecimal getTotalAmount() {
        return totalAmount;
    }
    
    public void setTotalAmount(BigDecimal totalAmount) {
        this.totalAmount = totalAmount;
    }
    
    public BigDecimal getPaidAmount() {
        return paidAmount;
    }
    
    public void setPaidAmount(BigDecimal paidAmount) {
        this.paidAmount = paidAmount;
    }
    
    public String getStatus() {
        return status;
    }
    
    public void setStatus(String status) {
        this.status = status;
    }
    
    public String getSource() {
        return source;
    }
    
    public void setSource(String source) {
        this.source = source;
    }
    
    public String getSpecialRequests() {
        return specialRequests;
    }
    
    public void setSpecialRequests(String specialRequests) {
        this.specialRequests = specialRequests;
    }
    
    public String getRemarks() {
        return remarks;
    }
    
    public void setRemarks(String remarks) {
        this.remarks = remarks;
    }
    
    public LocalDateTime getArrivalTime() {
        return arrivalTime;
    }
    
    public void setArrivalTime(LocalDateTime arrivalTime) {
        this.arrivalTime = arrivalTime;
    }
    
    public LocalDateTime getDepartureTime() {
        return departureTime;
    }
    
    public void setDepartureTime(LocalDateTime departureTime) {
        this.departureTime = departureTime;
    }
    
    @Override
    public String toString() {
        return "ReservationDTO{" +
                "customerName='" + customerName + '\'' +
                ", customerPhone='" + customerPhone + '\'' +
                ", customerIdCard='" + customerIdCard + '\'' +
                ", customerEmail='" + customerEmail + '\'' +
                ", roomTypeId=" + roomTypeId +
                ", roomId=" + roomId +
                ", checkinDate=" + checkinDate +
                ", checkoutDate=" + checkoutDate +
                ", guestCount=" + guestCount +
                ", roomCount=" + roomCount +
                ", totalAmount=" + totalAmount +
                ", paidAmount=" + paidAmount +
                ", status='" + status + '\'' +
                ", source='" + source + '\'' +
                ", specialRequests='" + specialRequests + '\'' +
                ", remarks='" + remarks + '\'' +
                ", arrivalTime=" + arrivalTime +
                ", departureTime=" + departureTime +
                '}';
    }
}